﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.BasicData.DTO;
using PowerHub.MES.DTO.BasicData.QueryDto;
using PowerHub.MES.DTO.Shopfloor.DTO;
using PowerHub.MES.DTO.Shopfloor.QueryDTO;
using PowerHub.MES.Entities.BasicData;
using PowerHub.MES.Entities.Shopfloor;
using PowerHub.MES.IServices.IBasic;
using PowerHub.MES.IServices.IShopfloor;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.Foundation
{

    /// <summary>
    /// 基地
    /// </summary>
    [ApiController]
    [Route("Api/MES/Shopfloor/[controller]/[action]")]
    public class FoundationController
    {

        private IShopfloor_FoundationServices _shopfloor_FoundationServices;

        public FoundationController(IShopfloor_FoundationServices FoundationServices)
        {
            _shopfloor_FoundationServices = FoundationServices;
        }

        /// <summary>
        /// 获取基地列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取基地列表")]
        public async Task<OperationPageResult<List<Shopfloor_Foundation>>> GetShopfloor_FoundationPageListAsync([FromBody] QueryShopfloor_FoundationDTO pageQuery)
        {
            return await _shopfloor_FoundationServices.GetShopfloor_FoundationPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除基地
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除基地")]
        public async Task<OperationResult<bool>> DeletionShopfloor_FoundationAsync([FromBody] List<string> Query)
        {
            return await _shopfloor_FoundationServices.DeletionShopfloor_FoundationAsync(Query);
        }

        /// <summary>
        /// 更新基地
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新基地")]
        public async Task<OperationResult<bool>> UpdateShopfloor_FoundationAsync([FromBody] Shopfloor_FoundationDTO Query)
        {
            return await _shopfloor_FoundationServices.UpdateShopfloor_FoundationAsync(Query);
        }

        /// <summary>
        /// 添加基地
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加基地")]
        public async Task<OperationResult<bool>> CreateShopfloor_FoundationAsync([FromBody] Shopfloor_FoundationDTO Query)
        {
            return await _shopfloor_FoundationServices.CreateShopfloor_FoundationAsync(Query);
        }
    }
}
